package com.example.logistics_manage.controller;

import com.example.logistics_manage.pojo.Carrier;
import com.example.logistics_manage.result.restful.R;
import com.example.logistics_manage.result.restful.ResponseEunm;
import com.example.logistics_manage.service.ICarrierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/carrier")
@CrossOrigin
public class CarrierController {
    @Autowired
    ICarrierService carrierService;

    /**
     * 查询所有
     * @return 1
     */
    @GetMapping("/selectAll")
    public R<List<Carrier>> selectAll(){
        return new R<>(ResponseEunm.SUCCESS,carrierService.selectAll());
    }
    @PostMapping("/selectCompany")
    public R<List<Carrier>> selectCompany(@RequestBody Carrier carrier){
        return new R<>(ResponseEunm.SUCCESS,carrierService.selectCompany(carrier));
    }
    @PostMapping("/updateCarrier")
    public R<?> updateCarrier(@RequestBody Carrier carrier){
        carrierService.updateCarrier(carrier);
        return new R<Carrier>(ResponseEunm.SUCCESS,null);
    }

}
